<div class="grid_9">
	<h1 class="dashboard">Receipts</h1>
</div>
<div class="clear"></div>
<div id="portlets">
	<div class="column"></div>
	<div class="clear"></div>
	<!--THIS IS A WIDE PORTLET-->
	<?php echo $this->element('backend/message');?>
	<div class="portlet">
	<div class="portlet-header fixed"><img src="<?php echo $this->webroot;?>img/backend/profiadmin/icons/user.gif" width="16" height="16" alt="" />Danh sach</div>
	<?php 
			echo $this->Form->create(array('name'=>'formlist'));
			echo $this->Form->hidden('bulk_action', array('id'=>'bulk_action'));
	?>
	<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a">
	<thead>
	<tr>
			<th><?php echo $this->Paginator->sort('User', 'trainee_id');?></th>
			<th><?php echo $this->Paginator->sort('payment_id');?></th>
			<th><?php echo $this->Paginator->sort('datecreated');?></th>
			<th><?php echo $this->Paginator->sort('amount');?></th>
			<th><?php echo $this->Paginator->sort('promotion_id');?></th>
			<th><?php echo $this->Paginator->sort('trans_amount');?></th>
			<th><?php echo $this->Paginator->sort('paymentstat');?></th>
			<th><?php echo $this->Paginator->sort('mark');?></th>
			<th><?php echo $this->Paginator->sort('subject_id');?></th>
			<th><?php echo $this->Paginator->sort('testslot_id');?></th>
			<th class="actions"><?php __('Actions');?></th>
	</tr>
	<thead>
	<?php
	$i = 0;
	foreach ($receipts as $receipt):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tbody>
	<tr<?php echo $class;?>>
		<td>
			<?php echo $this->Html->link($receipt['Trainee']['user'], array('controller' => 'trainees', 'action' => 'view', $receipt['Trainee']['id'])); ?>
		</td>
		<td>
			<?php echo $this->Html->link($receipt['Payment']['method'], array('controller' => 'payments', 'action' => 'view', $receipt['Receipt']['payment_id'])); ?>
		</td>
		<td><?php echo $receipt['Receipt']['datecreated']; ?>&nbsp;</td>
		<td><?php echo $receipt['Receipt']['amount']; ?>&nbsp;</td>
		<td>
			<?php echo $this->Html->link($receipt['Promotion']['code'], array('controller' => 'Promotions', 'action' => 'view', $receipt['Receipt']['promotion_id'])); ?>
		</td>
		<td><?php echo $receipt['Receipt']['trans_amount']; ?>&nbsp;</td>
		<td><?php echo $receipt['Receipt']['paymentstat']; ?>&nbsp;</td>
		<td><?php echo $receipt['Receipt']['mark']; ?>&nbsp;</td>
		<td>
			<?php echo $this->Html->link($receipt['Subject']['name'], array('controller' => 'subjects', 'action' => 'view', $receipt['Subject']['id'])); ?>
		</td>
		<td>
			<?php echo $this->Html->link($receipt['Testslot']['id'], array('controller' => 'testslots', 'action' => 'view', $receipt['Testslot']['id'])); ?>
		</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $receipt['Receipt']['id'])); ?>
			<?php echo $this->Html->link(__('Del', true), array('action' => 'delete', $receipt['Receipt']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $receipt['Receipt']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	<tr class="footer">
		<td colspan="3">
			<?php echo $this->element('backend/bulk_action');?>
		</td>						
		<td colspan="4" align="right">								
			<?php echo $this->element('backend/paginator');?>								    
		</td>
	</tr>

	</tbody>
	</table>
	<?php echo $form->end();?>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
</div>